from tensorboardX import SummaryWriter

# writer = SummaryWriter('runs/scalar_example')
# for i in range(10):
#     writer.add_scalar('quadratic', i**2, global_step=i)
#     writer.add_scalar('exponential', 2**i, global_step=i)

# writer = SummaryWriter('runs/another_scalar_example')
# for i in range(10):
#     writer.add_scalar('quadratic', i**3, global_step=i)
#     writer.add_scalar('exponential', 3**i, global_step=i)

# from tensorboardX import SummaryWriter
# import numpy as np
# writer = SummaryWriter('runs/embedding_example')
# writer.add_histogram('normal_centered', np.random.normal(0, 1, 1000), global_step=1)
# writer.add_histogram('normal_centered', np.random.normal(0, 2, 1000), global_step=50)
# writer.add_histogram('normal_centered', np.random.normal(0, 3, 1000), global_step=100)

from tensorboardX import SummaryWriter
import torchvision

writer = SummaryWriter('runs/embedding_example')
mnist = torchvision.datasets.MNIST('mnist', download=False)
a = mnist.train_data.reshape((-1, 28 * 28))[:100,:]
writer.add_embedding(
    mnist.train_data.reshape((-1, 28 * 28))[:100,:],
    metadata=mnist.train_labels[:100],
    label_img = mnist.train_data[:100,:,:].reshape((-1, 1, 28, 28)).float() / 255,
    global_step=0
)


